
#include "msg_telephone.h"
#include "page_base.h"
#include "img_common.h"
#include "sys_scene.h"
#include "pt_ipc.h"
#include "pt_info.h"
#include "pt_dev.h"
#include "sys_font.h"
#include "pt_fs.h"


static ui_msg_telephone_t  ui_msg_telephone;

static int msg_telephone_close_clicked_event(void)
{
    debug_d("telephone close\n");
    pop_win_unload();

    return 0;
}

static void msg_telephone_close_event_callback(lv_event_t* event)
{
    if (event->code == LV_EVENT_CLICKED)
    {
        msg_telephone_close_clicked_event();
    }
}



int ui_msg_telephone_create(lv_obj_t *superview)
{
    char txt_buff[256];
    //**********************************************************************************************
    ui_msg_telephone.title = lv_label_create(superview);
    lv_obj_set_pos(ui_msg_telephone.title,24,104);
    lv_obj_set_size(ui_msg_telephone.title,432,40);
    lv_obj_set_style_text_align(ui_msg_telephone.title,LV_TEXT_ALIGN_CENTER,0);
    lv_obj_set_style_text_opa(ui_msg_telephone.title,LV_OPA_100,LV_PART_MAIN);
    lv_obj_set_style_text_color(ui_msg_telephone.title,lv_color_make(0xff,0xff,0xff),LV_PART_MAIN); 
    lv_obj_set_style_text_font(ui_msg_telephone.title, lv_font_get(20), LV_STATE_DEFAULT);

    memset(txt_buff,0,sizeof(txt_buff));
    sprintf(txt_buff,"联系客服电话400-000-000");

    lv_label_set_text( ui_msg_telephone.title, txt_buff);
    //**********************************************************************************************
    //i known btn

    ui_msg_telephone.bg_txt = lv_obj_create(superview);

    lv_obj_set_pos(ui_msg_telephone.bg_txt,155,246);
    lv_obj_set_size(ui_msg_telephone.bg_txt,170,50);

	lv_obj_set_style_radius(ui_msg_telephone.bg_txt, 25, LV_PART_MAIN);
	lv_obj_set_style_border_width(ui_msg_telephone.bg_txt, 0, LV_PART_MAIN);
	lv_obj_set_style_border_color(ui_msg_telephone.bg_txt, lv_color_make(0x00, 0x00, 0x00), LV_PART_MAIN);
	lv_obj_set_style_border_opa(ui_msg_telephone.bg_txt, LV_OPA_0, LV_PART_MAIN);

	lv_obj_set_style_outline_width(ui_msg_telephone.bg_txt, 0, LV_PART_MAIN);
	lv_obj_set_style_shadow_width(ui_msg_telephone.bg_txt, 0, LV_PART_MAIN);
	lv_obj_set_scrollbar_mode(ui_msg_telephone.bg_txt, LV_SCROLLBAR_MODE_OFF);
	lv_obj_set_style_pad_all(ui_msg_telephone.bg_txt, 0,0);
    
    #if 0
    lv_obj_set_style_bg_opa(ui_msg_telephone.bg_txt,LV_OPA_0,0);
    #else
    lv_obj_set_style_bg_opa(ui_msg_telephone.bg_txt,LV_OPA_100,0);
    lv_obj_set_style_bg_color(ui_msg_telephone.bg_txt,lv_color_make(0x26,0x7a,0xff),0);
    #endif 

    lv_obj_add_event_cb(ui_msg_telephone.bg_txt, msg_telephone_close_event_callback, LV_EVENT_ALL, NULL);
    //**********************************************************************************************
    ui_msg_telephone.txt = lv_label_create(superview);
    lv_obj_set_pos(ui_msg_telephone.txt,115,255);
    lv_obj_set_size(ui_msg_telephone.txt,250,30);
    lv_obj_set_style_text_align(ui_msg_telephone.txt,LV_TEXT_ALIGN_CENTER,0);
    lv_obj_set_style_text_opa(ui_msg_telephone.txt,LV_OPA_100,LV_PART_MAIN);
    lv_obj_set_style_text_color(ui_msg_telephone.txt,lv_color_make(0xff,0xff,0xff),LV_PART_MAIN); 
    lv_obj_set_style_text_font(ui_msg_telephone.txt, lv_font_get(24), LV_STATE_DEFAULT);

    lv_label_set_text(ui_msg_telephone.txt,"知道了");
    //**********************************************************************************************



    return 0;

}



static void msg_telephone_on_custom_attr_config(page_base_t* self)
{


}
static void msg_telephone_on_view_load(page_base_t* self)
{


}
static void msg_telephone_on_view_did_load(page_base_t* self)
{
    ui_msg_telephone_create(self->root);

}
static void msg_telephone_on_view_will_appear(page_base_t* self)
{


}
static void msg_telephone_on_view_did_appear(page_base_t* self)
{


}
static void msg_telephone_on_view_will_disappear(page_base_t* self)
{


}
static void msg_telephone_on_view_did_disappear(page_base_t* self)
{


}
static void msg_telephone_on_view_did_unload(page_base_t* self)
{


}

static page_vtable_t page_msg_telephone_param = {

    .on_custom_attr_config  = msg_telephone_on_custom_attr_config,
    .on_view_load           = msg_telephone_on_view_load,
    .on_view_did_load       = msg_telephone_on_view_did_load,
    .on_view_will_appear    = msg_telephone_on_view_will_appear,
    .on_view_did_appear     = msg_telephone_on_view_did_appear,
    .on_view_will_disappear = msg_telephone_on_view_will_disappear,
    .on_view_did_disappear  = msg_telephone_on_view_did_disappear,
    .on_view_did_unload     = msg_telephone_on_view_did_unload,
};


page_vtable_t* lv_page_msg_telephone_create(void)
{
    return &page_msg_telephone_param;
}
